package com.ra.util;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author colin
 * @date 2014年10月21日
 */
public class CheckUtil {
	public static boolean isPhoneIdCard(String number) {
		boolean flag = false;
		try {
			//正确格式"13975745788-1121"
			Pattern p = Pattern.compile("^[0-9]{11}[\\-][0-9]{3}[0-9|X|x]$");
			Matcher m = p.matcher(number);
			flag = m.matches();
		} catch (Exception e) {
			flag = false;
		}
		return flag;
	}
	
	
	public static boolean isPhoneNum(String number) {
		boolean flag = false;
		try {
			//正确格式"13975745788"
			Pattern p = Pattern.compile("^[0-9]{11}$");
			Matcher m = p.matcher(number);
			flag = m.matches();
		} catch (Exception e) {
			flag = false;
		}
		return flag;
	}
}
